package ru.alperez.gpsdub.transfer;

import android.content.Context;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;

public class DatabaseHelper extends SQLiteOpenHelper {

	public DatabaseHelper(Context context) {
		super(context, "gps_dub", null, 4); //!!! reset
	}

	@Override
	public void onCreate(SQLiteDatabase db) {
		db.execSQL("CREATE TABLE Point		(dateTime INTEGER PRIMARY KEY, name TEXT, description TEXT, localDate INTEGER, localTime INTEGER, accuracy REAL, altitude REAL, bearing REAL, latitude REAL, longitude REAL, provider TEXT, speed REAL, nsat INTEGER, creatorId integer);");
		db.execSQL("CREATE TABLE Creator	(id INTEGER NOT NULL PRIMARY KEY, name TEXT, description TEXT, device TEXT, model TEXT, imei TEXT);");
	}

	@Override
	public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
		db.execSQL("DROP TABLE IF EXISTS Points");
		db.execSQL("DROP TABLE IF EXISTS Creator");
		onCreate(db);
	}

}

